package com.wing.order.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wing.order.model.entity.OrderDeliverySign;
import com.wing.order.model.response.*;
import com.wing.product.model.response.ProductDetailVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 签收记录-Dao
 *
 * @author
 */
@Mapper
public interface OrderDeliverySignDao extends BaseMapper<OrderDeliverySign> {

    /**
     * 列表-app
     *
     * @param params
     *
     * @return
     */
    List<OrderDeliverySignVO> list4app(@Param("params") Map<String, Object> params);

    /**
     * 分页列表-app
     *
     * @param page
     * @param params
     *
     * @return
     */
    List<OrderDeliverySignVO> list4app(@Param("page") Page<OrderDeliverySignVO> page, @Param("params") Map<String, Object> params);

    /**
     * 详情-app
     *
     * @param id
     *
     * @return
     */
    OrderDeliverySignVO get4appById(Long id);

    Integer countNotFinish(Long signId);

    public Page<OrderDeliverySignVO> getOrderDeliverySignVOPageList (IPage<OrderDeliverySignVO> page, @Param("ew") QueryWrapper<OrderDeliverySignVO> queryWrapper);

    public Page<OrderDeliverySignDetailVO> getSignDetailList (IPage<OrderDeliverySignDetailVO> page, @Param("ew") QueryWrapper<OrderDeliverySignDetailVO> queryWrapper);

    public Page<OrderDeliverySignDetailVO> getSignStorageDetailList (IPage<OrderDeliverySignDetailVO> page, @Param("ew") QueryWrapper<OrderDeliverySignDetailVO> queryWrapper);
    /**
     * 查询料箱
     * @param code
     * @return
     */
    WorkbinVO getWorkbinByCode(@Param("code") String code);

    /**
     * 查询托盘存放物资列表
     * @param boxId
     * @return
     */
    List<MaterialVO> getMaterialVOListById(@Param("boxId") Long boxId);

    /**
     * 扫描包装条码（）
     * @param packLabelCode
     * @param signId
     * @return
     */
    OrderDeliveryLabelVO getDeliveryLabelVOByCode(@Param("packLabelCode") String packLabelCode, @Param("signId") Long signId);

    /**
     * 查询产品的料箱
     * @return
     */
    List<WorkbinVO> getProductBoxByDetailId(@Param("deliveryDetailId") Long deliveryDetailId);

    /**
     * 查询料箱的包装条码
     * @param boxId
     * @return
     */
    List<OrderDeliveryLabelVO> getDeliveryLabelVOByBoxId(@Param("boxId") Long boxId);

    /**
     * 进销存入库签收列表
     * @param page
     * @param queryWrapper
     * @return
     */
    public Page<OrderDeliverySignVO> getInventorySignVOPageList (IPage<OrderDeliverySignVO> page, @Param("ew") QueryWrapper<OrderDeliverySignVO> queryWrapper);


    /**
     * 异常数量列表
     * @param id 签收记录id
     * @return
     */
    List<OrderDeliverySignVO> abnormalList(@Param("id")Long id);

    /**
     * 采购签收列表
     * @param page
     * @return
     */
    List<OrderDeliverySignVO> getPurchaseSignVOPageList (@Param("page") Page<ProductDetailVO> page, @Param("params") Map<String, Object> params);

    OrderDeliverySignVO getDeliverySignInfo(@Param("code") String code,@Param("signType") Integer signType);

    /**
     * 采购 根据id查询主表
     * @param id
     * @return
     */
    OrderDeliverySignVO getPurchaseSignVOById (@Param("id") Long id);
    /**
     * 采购 根据id查询详情
     * @param id
     * @return
     */
    List<OrderDeliverySignDetailVO> getPurchaseSignDetailVO (@Param("id") Long id);
}
